﻿using MediatR;
using RBAC.LuFang.API.Application.Command.GoodsCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.GoodsHandler
{
    //商品修改
    public class GoodsUpdCommandHandler:IRequestHandler<GoodsUpdCommand,int>
    {
        private readonly IGoodsService _goodsService;

        public GoodsUpdCommandHandler(IGoodsService goodsService)
        {
            _goodsService = goodsService;
        }

        public async Task<int> Handle(GoodsUpdCommand request, CancellationToken cancellationToken)
        {
            var updmodel = new Goods() { goodsId=request.goodsId, goodsName=request.goodsName, goodsProductionBatch=request.goodsProductionBatch, goodsperiod=request.goodsperiod, goodsNumber=request.goodsNumber, goodsQiYe=request.goodsQiYe, goodsImg=request.goodsImg, addName=request.addName, addDate=request.addDate };
            return await _goodsService.UpdGoods(updmodel);
        }
    }
}
